/**
 * @copyright Copyright (c) 2025 
 * CSG Digital Grid Technology (Guangdong) Co., Ltd.
 * @author klg
 * @brief MQTT请求处理相关头文件，包含MQTT消息请求处理接口
 */
#ifndef __MQTT_REQUEST_HANDLE_H__
#define __MQTT_REQUEST_HANDLE_H__



#define MODEL_NAME_LEN_MAX  50


extern char *err_table[];


int mqtt_error_ack(char *str_err, cJSON *token, char *response, char *app);

int get_token_str(char *p);

int mqtt_ack_msg_prepare(cJSON *r_jn, char *token);
int mqtt_ack_msg_send(cJSON *r_jn, char *response, char *app);

int table_have_property(char *table, char *key, char *val);
int get_model_regist_dev(char *model_name, cJSON *Array);
int get_proerty_of_model(cJSON *jn, struct model_property_s *p, char **p_err_no);

int time_valid_check(char *t);
int model_and_dev_regist_check(char *model, char *dev);
int model_regist_check(char *model);
int delete_model(char *model, char **err_no, char *err_buff);
int mqtt_response_ok_failure(int sta, char *response, char *app, char *token);

int topic_get_versin(char* app, char *tpc, char *msg, char *response);
int topic_get_modelschema(char* app, char *tpc, char *msg, char *response);
int topic_action_deletemodel(char* app, char *tpc, char *msg, char *response);
int topic_get_model(char* app, char *tpc, char *msg, char *response);
int topic_set_model(char* app, char *tpc, char *msg, char *response);

int topic_get_guid(char* app, char *tpc, char *msg, char *response);
int topic_set_register(char* app, char *tpc, char *msg, char *response);
int topic_get_register(char* app, char *tpc, char *msg, char *response);
int topic_action_unregister(char* app, char *tpc, char *msg, char *response);
int topic_notify_event(char* app, char *tpc, char *msg, char *response);
int topic_get_realtime(char* app, char *tpc, char *msg, char *response);

int topic_get_dev_status(char* app, char *tpc, char *msg, char *response);

int topic_set_dev_status(char *app, char *tpc, char *msg, char *response);

int topic_set_register_V2(char* app, char *tpc, char *msg, char *response);

#endif  /* __MQTT_REQUEST_HANDLE_H__ */
